﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LardonPokerSimulator.Model.Observers
{
    public abstract class Subject
    {
        private List<IObserver> _observers = new List<IObserver>();

        public void Attach(IObserver aNewObserver)
        {
            this._observers.Add(aNewObserver);
        }

        public void AttachRange(IEnumerable<IObserver> aCollectionObservers)
        {
            this._observers.AddRange(aCollectionObservers);
        }

        public void Detach(IObserver aObserver)
        {
            this._observers.Remove(aObserver);
        }

        public void NotifyObservers()
        {
            foreach (IObserver o in this._observers)
            {
                o.Updates(this);
            }
        }

    }
}
